home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / BLOB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  5.0 KB  |  138 lines

  1. /****************************************************************************
  2. *                   blob.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for BLOB.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24.  
  25. #ifndef BLOB_H
  26. #define BLOB_H
  27.  
  28. #include "bsphere.h"
  29.  
  30.  
  31.  
  32. /*****************************************************************************
  33. * Global preprocessor defines
  34. ******************************************************************************/
  35.  
  36. #define BLOB_OBJECT (STURM_OK_OBJECT+HIERARCHY_OK_OBJECT)
  37.  
  38. /* Do not use the first bit!!! (Used for enter/exit in intersection test) */
  39.  
  40. #define BLOB_SPHERE               2
  41. #define BLOB_CYLINDER             4
  42. #define BLOB_ELLIPSOID            8
  43. #define BLOB_BASE_HEMISPHERE     16
  44. #define BLOB_APEX_HEMISPHERE     32
  45. #define BLOB_BASE_HEMIELLIPSOID  64
  46. #define BLOB_APEX_HEMIELLIPSOID 128
  47.  
  48.  
  49. /* Define max. number of blob components. */
  50.  
  51. #define MAX_BLOB_COMPONENTS 1000000
  52.  
  53. /* Generate additional blob statistics. */
  54.  
  55. #define BLOB_EXTRA_STATS 1
  56.  
  57.  
  58.  
  59. /*****************************************************************************
  60. * Global typedefs
  61. ******************************************************************************/
  62.  
  63. typedef struct Blob_Struct BLOB;
  64. typedef struct Blob_Element_Struct BLOB_ELEMENT;
  65. typedef struct Blob_Data_Struct BLOB_DATA;
  66. typedef struct blob_list_struct *blobstackptr;
  67.  
  68. struct Blob_Element_Struct
  69. {
  70.   short Type;       /* Type of component: sphere, hemisphere, cylinder */
  71.   int index;
  72.   VECTOR O;         /* Element's origin                                */
  73.   DBL len;          /* Cylinder's length                               */
  74.   DBL rad2;         /* Sphere's/Cylinder's radius^2                    */
  75.   DBL c[3];         /* Component's coeffs                              */
  76.   DBL f[5];         /* Component's final coeffs                        */
  77.   TEXTURE *Texture; /* Component's texture                             */
  78.   TRANSFORM *Trans; /* Component's transformation                      */
  79. };
  80.  
  81. struct Blob_Data_Struct
  82. {
  83.   int References;           /* Number of references     */
  84.   int Number_Of_Components; /* Number of components     */
  85.   DBL Threshold;            /* Blob threshold           */
  86.   BLOB_ELEMENT *Entry;      /* Array of blob components */
  87.   BSPHERE_TREE *Tree;       /* Bounding hierarchy       */
  88. };
  89.  
  90. struct Blob_Struct
  91. {
  92.   OBJECT_FIELDS
  93.   TRANSFORM *Trans;
  94.   BLOB_DATA *Data;    /* Pointer to blob data  */
  95.   TEXTURE **Element_Texture;
  96. };
  97.  
  98. struct blob_list_struct
  99. {
  100.   BLOB_ELEMENT elem;  /* Current element          */
  101.   blobstackptr next;  /* Pointer to next element  */
  102. };
  103.  
  104.  
  105.  
  106. /*****************************************************************************
  107. * Global variables
  108. ******************************************************************************/
  109.  
  110. extern METHODS Blob_Methods;
  111.  
  112.  
  113.  
  114. /*****************************************************************************
  115. * Global functions
  116. ******************************************************************************/
  117.  
  118. void Set_Blob_Solver PARAMS((OBJECT *obj, int Sturm_Flag));
  119. void Init_Blob_Queue PARAMS((void));
  120. void BlobDelete PARAMS((OBJECT *obj));
  121. BLOB *Create_Blob PARAMS((void));
  122. void Make_Blob PARAMS((BLOB *blob, DBL threshold, blobstackptr bloblist, int npoints));
  123. blobstackptr Create_Blob_List_Element PARAMS((void));
  124. void Create_Blob_Element_Texture_List PARAMS((BLOB *Blob, blobstackptr BlobList, int npoints));
  125. void Determine_Blob_Textures PARAMS((BLOB *Blob, VECTOR P, int *Count, TEXTURE **Textures, DBL *Weights));
  126. void Test_Blob_Opacity PARAMS((BLOB *Blob));
  127.  
  128. void Translate_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  129. void Rotate_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  130. void Scale_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  131. void Invert_Blob_Element PARAMS((BLOB_ELEMENT *Element));
  132. void Transform_Blob_Element PARAMS((BLOB_ELEMENT *Element, TRANSFORM *Trans));
  133. void Destroy_Blob_Queue PARAMS((void));
  134.  
  135.  
  136.  
  137. #endif
  138.